import {defineStore} from "pinia";
import {ref} from "vue";

export const useUserInfoStore = defineStore('userInfo', () => {
    let userInfo = ref({})
    let userDataList = ref([]);
    let userSearchData = ref({});
    let addOrUpdateDialog = ref(false);
    let userDeleteDialog = ref(false);
    let userRoleAuthorisationDialog = ref(false);

    function resetUserInfo(info) {
        userInfo.value = info;
    }

    function resetUserDataList(info) {
        userDataList.value = info;
    }

    function resetUserSearchData(info) {
        userSearchData.value = info;
    }

    function resetAddOrUpdateDialog(flag) {
        addOrUpdateDialog.value = flag;
    }

    function resetUserDeleteDialog(flag) {
        userDeleteDialog.value = flag;
    }

    function resetUserRoleAuthorisationDialog(flag) {
        userRoleAuthorisationDialog.value = flag;
    }

    return { userInfo, resetUserInfo, userDataList, resetUserDataList, userSearchData, resetUserSearchData, addOrUpdateDialog, resetAddOrUpdateDialog,
        userDeleteDialog, resetUserDeleteDialog, userRoleAuthorisationDialog, resetUserRoleAuthorisationDialog }
})